﻿CREATE TABLE [dbo].[ew_tbl_fields]
(
    [ew_uid_field_id] UNIQUEIDENTIFIER NOT NULL , 
    [ew_uid_field_type_id] UNIQUEIDENTIFIER NOT NULL , 
    [ew_uid_entity_id] UNIQUEIDENTIFIER NOT NULL, 
    [ew_xml_value] XML([dbo].[ew_xsdc_field_value]) NOT NULL,
    [ew_dt_created] DATETIME NOT NULL, 
    [ew_nvc_created_by] NVARCHAR(1024) NOT NULL, 
    [ew_dt_modified] DATETIME NOT NULL, 
    [ew_nvc_modified_by] NVARCHAR(1024) NOT NULL, 
    [ew_t_timestamp] TIMESTAMP NOT NULL, 
    CONSTRAINT [ew_pk_tbl_fields] PRIMARY KEY ([ew_uid_field_id]), 
    CONSTRAINT [ew_fk_tbl_fields_entities] FOREIGN KEY ([ew_uid_entity_id]) REFERENCES [ew_tbl_entities]([ew_uid_entity_id])
)

GO

CREATE PRIMARY XML INDEX [ew_ix_tbl_fields_xml_value] ON [dbo].[ew_tbl_fields] ([ew_xml_value])
